\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{math}

\begin{document}
	\begin{tikzpicture}
		\begin{axis}[
			width=12cm,
			height=8cm,
			xmin = pi/12-0.1, xmax = 11*pi/12+0.1,
			ymin = -1.5, ymax = 0.3,
			axis lines = middle,
			xlabel = $x$,
			ylabel = $y$,
			xtick = {pi/12, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, 11*pi/12},
			xticklabels = {$\frac{\pi}{12}$,$\frac{\pi}{6}$,$\frac{\pi}{4}$,$\frac{\pi}{3}$,$\frac{\pi}{2}$,
				$\frac{2\pi}{3}$,$\frac{3\pi}{4}$,$\frac{5\pi}{6}$,$\frac{11\pi}{12}$},
			ytick = {-1.5,-1.0,-0.5,0},
			grid = both,
			grid style = {dashed, gray!30},
			axis equal image=false,
			clip = false
			]
			
			% 绘制函数 y = ln(sin(x))
			\addplot[
			domain = pi/12:11*pi/12,
			samples = 300,
			smooth,
			thick,
			blue
			] {ln(sin(deg(x)))} node[pos=0.2, above] {$y = \ln(\sin x)$};
			
			% 标记水平切线点 (π/2, 0)
			\node[circle, fill=red, inner sep=1.5pt, label=above right:{$\left(\frac{\pi}{2}, 0\right)$}] at (axis cs:pi/2,0) {};
			
			% 绘制水平切线
			\draw[dashed, red, thick] (axis cs:pi/12+0.4,0) -- (axis cs:11*pi/12-0.2,0) 
			node[midway, below] {水平切线 $y'=0$};
			
			% 标记端点
			\node[circle, fill=green, inner sep=1pt] at (axis cs:pi/12,{ln(sin(deg(pi/12)))}) {};
			\node[circle, fill=green, inner sep=1pt] at (axis cs:11*pi/12,{ln(sin(deg(11*pi/12)))}) {};
			
			% 添加罗尔定理说明
			%\node[align=left, text width=8cm] at (axis cs:pi/3, -1.3) {
			%	函数 $y = \ln(\sin x)$ 在 $\left[\frac{\pi}{12},\frac{11\pi}{12}\right]$ 上：\\
			%	$\bullet$ 连续且可导（在区间内 $\sin x > 0$） \\
			%	$\bullet$ $f(a) = f(b) = \ln\left(\sin\frac{\pi}{12}\right) = %\ln\left(\sin\frac{11\pi}{12}\right)$ \\
			%	$\bullet$ 在 $x = \frac{\pi}{2}$ 处 $y' = \cot\left(\frac{\pi}{2}\right) = 0$ \\
			%	满足罗尔中值定理所有条件
			%};
		\end{axis}
	\end{tikzpicture}
\end{document}